-
-
Notifications
You must be signed in to change notification settings - Fork 124
[Platform] Migrate OpenAI to Responses API #871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
lol, please hold. Forgot to add a whole bunch of tests. Feel free to review functionality in the meantime |
47ae95d to
57f7762
Compare
57f7762 to
546019d
Compare
546019d to
9af9306
Compare
9af9306 to
064c45e
Compare
Since `o1` models are deprecated, and the Responses API no longer supports `o1`. See: https://platform.openai.com/docs/deprecations#2025-04-28-o1-preview-and-o1-mini
064c45e to
70d3673
Compare
Since we're migrating to the Responses API (from chat completions), and
that API doesn't support audio yet. It should be added back when it does
("coming soon", apparently)
See: https://platform.openai.com/docs/guides/migrate-to-responses
As every OpenAI model with vision capabilities also support PDF input, as per docs: https://platform.openai.com/docs/guides/pdf-files?api-mode=responses
In order to migrate from chat completions to Responses, which enforces different data structures
Since we're migration from chat completions to Responses, which has a differnt data structure for function calls
To migrate from OpenAI's chat completions to Responses, we need to change incoming messages to the updated data structure
Chat completions is deprecated. Responses is the recommended API to use now. See: https://platform.openai.com/docs/guides/migrate-to-responses
70d3673 to
8166232
Compare
chr-hertel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| $result = $agent->call($messages, ['response_format' => [ | ||
| $result = $agent->call($messages, ['text' => ['format' => [ | ||
| 'type' => 'json_schema', | ||
| 'json_schema' => [ | ||
| 'name' => 'clock', | ||
| 'strict' => true, | ||
| 'schema' => [ | ||
| 'type' => 'object', | ||
| 'properties' => [ | ||
| 'date' => ['type' => 'string', 'description' => 'The current date in the format YYYY-MM-DD.'], | ||
| 'time' => ['type' => 'string', 'description' => 'The current time in the format HH:MM:SS.'], | ||
| ], | ||
| 'required' => ['date', 'time'], | ||
| 'additionalProperties' => false, | ||
| 'name' => 'clock', | ||
| 'strict' => true, | ||
| 'schema' => [ | ||
| 'type' => 'object', | ||
| 'properties' => [ | ||
| 'date' => ['type' => 'string', 'description' => 'The current date in the format YYYY-MM-DD.'], | ||
| 'time' => ['type' => 'string', 'description' => 'The current time in the format HH:MM:SS.'], | ||
| ], | ||
| 'required' => ['date', 'time'], | ||
| 'additionalProperties' => false, | ||
| ], | ||
| ]]); | ||
| ]]]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after reverting these changes, the example will work again - i guess that due to my hackle with that other PR, sry!
|
I extracted the |

This PR migrates OpenAI from chat completions (deprecated) to the Responses API. I tried to keep the scope small and just support everything already in place as seamlessly as possible. The Responses API does offer some more functionality that we should look into supporting (e.g. MCP tool calling, expanded reasoning functionality), but I found that OOS for this migration.
One thing to note it that the Responses API as of now lacks Audio capabilities ("coming soon", according to the docs), so that example is temporarily disabled and so is the
Gptaudio capability for now.Note: my PRs are best reviewed commit by commit